/* 
 * File:   base.h
 * Author: cow
 *
 * Created on April 14, 2011, 2:08 PM
 */

#ifndef _BASE_H
#define	_BASE_H

//includes-----------------------------
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <ncurses.h>
using namespace std;

//defines------------------------------
namespace base{
enum resourceType{
    metal = 0,
    chem,
    fuel,
    crew,
    RES_MAX
};
}

//prototypes---------------------------
namespace base{
int selftest();
class resourceLayer;
class tradeLayer;
class tradeRoute;
class diplomacyLayer;
class planet;
}

//definitionsresourceLayer--------------------------
namespace base{
//base+++++++++++++
class resourceLayer{
public:
    //constructors------
    resourceLayer();
    void initPop(float seedpop, int popmax, float grate);
    void initInd(int indseed[], float indratios[], int costs[][RES_MAX]);
    ~resourceLayer();
    //stats-------------
    int population();
    int industry();
    float effeciency();
    void effeciency(float eff);
    int industry(resourceType tp);
    float industryRatio(resourceType tp);
    int resource(resourceType tp);
    int availableRes(resourceType tp);
    //eot---------------
    bool update();
    //resourcing--------
    float getAVRatio(resourceType tp);
    void setAVRatio(float avr[]);
    void requestRes(int* resArr);
    int removeAvailRes(resourceType tp, int num);
    int removeRes(resourceType tp, int num);
    int addRes(resourceType tp, int num);
protected:
    bool updatePop();
    bool updateInd();
    bool updateRes();
private:
    //EOT---------------
    bool updated;
    //population--------
    float pop;
    int popmax;
    float popGRate;
    //industry----------
    float efficiency;
    float industryPoints[RES_MAX];
    float industryRatios[RES_MAX];
    int industryCost[RES_MAX][RES_MAX];
    //resources---------
    float AVRatio[RES_MAX];
    int resourcePoints[RES_MAX];
};
//tradelayer+++++++
class tradeLayer{
public:
    //constructors------
    tradeLayer();
    ~tradeLayer();
    //tradeRoutes-------
private:

};
class tradeRoute{
public:
    tradeRoute(tradeLayer* edge1, tradeLayer* edge2);
    ~tradeRoute();
	int request(resourceType tp, tradeLayer* requester);;
private:
	tradeLayer* edge1;
	tradeLayer* edge2;
};
class diplomacyLayer{
public:
private:
    //effect how plaets respond to player requests
    int* lovehateScale;
    int* fearadmireScale;
    int influencingPlayer;
};
class planet{
    
};
}
#endif	/* _BASE_H */
